/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package loginview;


import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.io.*;
import net.proteanit.sql.DbUtils;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;

public class MainViewFrame extends javax.swing.JFrame {
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;
    /**
     * Creates new form MainViewFrame
     */
    public MainViewFrame() {
        initComponents();
        conn = JavaConnect.ConnecrDb();
        FillCombo();
        CurrentDate();
        Update_IncomeTable();
        Update_OutcomeTable();
        Update_DocumentTable();
        
        
        
//        ImageIcon img = new ImageIcon(pathToFileOnDisk);	
//        mYFrame.setIconImage(img.getImage());  icon of frame
    }
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        machinePanel = new javax.swing.JPanel();
        selectMachine = new javax.swing.JComboBox();
        reportPanel = new javax.swing.JPanel();
        incomeButton = new javax.swing.JButton();
        outcomeButton = new javax.swing.JButton();
        totalButton = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jToolBar1 = new javax.swing.JToolBar();
        homeButton = new javax.swing.JButton();
        employerButton = new javax.swing.JButton();
        profileButton = new javax.swing.JButton();
        logoutButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        label_date = new javax.swing.JLabel();
        label_time = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        mainTable = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabbedIncomeTable = new javax.swing.JTable();
        lbl_empname = new javax.swing.JLabel();
        lbl_empsurname = new javax.swing.JLabel();
        txtEmpName = new javax.swing.JTextField();
        txtEmpSurname = new javax.swing.JTextField();
        lbl_machinename = new javax.swing.JLabel();
        txtEmpMachineName = new javax.swing.JTextField();
        lbl_machineid = new javax.swing.JLabel();
        txtEmpMachineID = new javax.swing.JTextField();
        txtClientName = new javax.swing.JTextField();
        lbl_clientname = new javax.swing.JLabel();
        lbl_money = new javax.swing.JLabel();
        txtProjectName = new javax.swing.JTextField();
        lbl_incomedate = new javax.swing.JLabel();
        lbl_project = new javax.swing.JLabel();
        txtMoney = new javax.swing.JTextField();
        txtDate = new com.toedter.calendar.JDateChooser();
        lbl_empid = new javax.swing.JLabel();
        txtEmpID = new javax.swing.JTextField();
        saveButton = new javax.swing.JButton();
        lbl_service = new javax.swing.JLabel();
        updateButton = new javax.swing.JButton();
        selectService = new javax.swing.JComboBox();
        clearButton = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tabbedOutcomeTable = new javax.swing.JTable();
        lbl_id = new javax.swing.JLabel();
        txtEmpid = new javax.swing.JTextField();
        txtEmpname = new javax.swing.JTextField();
        lbl_name = new javax.swing.JLabel();
        txtEmpsurname = new javax.swing.JTextField();
        lbl_surname = new javax.swing.JLabel();
        txtEmpMachinename = new javax.swing.JTextField();
        lbl_machine_name = new javax.swing.JLabel();
        txtEmpMachineid = new javax.swing.JTextField();
        lbl_machine_id = new javax.swing.JLabel();
        txtMaintenance = new javax.swing.JTextField();
        lbl_maintenance = new javax.swing.JLabel();
        txtSalary = new javax.swing.JTextField();
        lbl_salary = new javax.swing.JLabel();
        txtDateOutcome = new com.toedter.calendar.JDateChooser();
        lbl_date = new javax.swing.JLabel();
        clearOutcomeButton = new javax.swing.JButton();
        saveOutcomeButton = new javax.swing.JButton();
        updateOutcomeButton = new javax.swing.JButton();
        chartButton = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        fileChooseButton = new javax.swing.JButton();
        txtChooser = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        tabbedDocTable = new javax.swing.JTable();
        txtDocNumber = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtComments = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        saveDocButton = new javax.swing.JButton();
        clearDocButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setLocation(new java.awt.Point(120, 20));
        setPreferredSize(new java.awt.Dimension(1050, 765));

        machinePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Machinary", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 3, 10))); // NOI18N

        selectMachine.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                selectMachinePopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
        });

        javax.swing.GroupLayout machinePanelLayout = new javax.swing.GroupLayout(machinePanel);
        machinePanel.setLayout(machinePanelLayout);
        machinePanelLayout.setHorizontalGroup(
            machinePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(selectMachine, javax.swing.GroupLayout.Alignment.TRAILING, 0, 113, Short.MAX_VALUE)
        );
        machinePanelLayout.setVerticalGroup(
            machinePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(machinePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(selectMachine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        reportPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Report", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 3, 10))); // NOI18N

        incomeButton.setText("Income");
        incomeButton.setMaximumSize(new java.awt.Dimension(90, 30));
        incomeButton.setPreferredSize(new java.awt.Dimension(90, 30));
        incomeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                incomeButtonActionPerformed(evt);
            }
        });

        outcomeButton.setText("Outcome");
        outcomeButton.setMaximumSize(new java.awt.Dimension(101, 30));
        outcomeButton.setPreferredSize(new java.awt.Dimension(101, 30));
        outcomeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                outcomeButtonActionPerformed(evt);
            }
        });

        totalButton.setText("Total");
        totalButton.setMaximumSize(new java.awt.Dimension(76, 30));
        totalButton.setPreferredSize(new java.awt.Dimension(76, 30));
        totalButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                totalButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout reportPanelLayout = new javax.swing.GroupLayout(reportPanel);
        reportPanel.setLayout(reportPanelLayout);
        reportPanelLayout.setHorizontalGroup(
            reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(incomeButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(outcomeButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)
            .addComponent(totalButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        reportPanelLayout.setVerticalGroup(
            reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(reportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(incomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(outcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(totalButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButton1.setText("jButton1");

        jToolBar1.setRollover(true);
        jToolBar1.setMaximumSize(new java.awt.Dimension(100, 50));
        jToolBar1.setPreferredSize(new java.awt.Dimension(100, 50));

        homeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/green-home-icon.png"))); // NOI18N
        homeButton.setText("Home");
        homeButton.setFocusable(false);
        homeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        homeButton.setMaximumSize(new java.awt.Dimension(75, 60));
        homeButton.setPreferredSize(new java.awt.Dimension(75, 60));
        homeButton.setSize(new java.awt.Dimension(75, 60));
        homeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        homeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                homeButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(homeButton);

        employerButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Users-Workers-icon.png"))); // NOI18N
        employerButton.setText("Employee");
        employerButton.setToolTipText("");
        employerButton.setMaximumSize(new java.awt.Dimension(110, 60));
        employerButton.setPreferredSize(new java.awt.Dimension(110, 60));
        employerButton.setSize(new java.awt.Dimension(110, 60));
        employerButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                employerButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(employerButton);

        profileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Profile-icon.png"))); // NOI18N
        profileButton.setText("Profile");
        profileButton.setMaximumSize(new java.awt.Dimension(90, 60));
        profileButton.setPreferredSize(new java.awt.Dimension(90, 60));
        profileButton.setSize(new java.awt.Dimension(90, 60));
        profileButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                profileButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(profileButton);

        logoutButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Log-Out-icon.png"))); // NOI18N
        logoutButton.setText("Log out");
        logoutButton.setFocusable(false);
        logoutButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        logoutButton.setMaximumSize(new java.awt.Dimension(90, 60));
        logoutButton.setPreferredSize(new java.awt.Dimension(90, 60));
        logoutButton.setSize(new java.awt.Dimension(90, 60));
        logoutButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(logoutButton);

        jLabel1.setMaximumSize(new java.awt.Dimension(400, 60));
        jLabel1.setPreferredSize(new java.awt.Dimension(400, 60));
        jToolBar1.add(jLabel1);

        label_date.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        label_date.setForeground(new java.awt.Color(51, 51, 51));
        label_date.setText("Date");
        label_date.setMaximumSize(new java.awt.Dimension(150, 55));
        label_date.setPreferredSize(new java.awt.Dimension(150, 55));
        jToolBar1.add(label_date);

        label_time.setFont(new java.awt.Font("Lucida Grande", 1, 14)); // NOI18N
        label_time.setForeground(new java.awt.Color(51, 51, 51));
        label_time.setText("Time");
        label_time.setMaximumSize(new java.awt.Dimension(150, 55));
        label_time.setPreferredSize(new java.awt.Dimension(150, 55));
        label_time.setSize(new java.awt.Dimension(150, 55));
        jToolBar1.add(label_time);

        mainTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Employee_id", "Name", "Surname", "Machine_name", "Machine_id"
            }
        ));
        mainTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mainTableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(mainTable);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Edit"), "Workspace", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 1, 12), new java.awt.Color(51, 51, 51))); // NOI18N

        jTabbedPane1.setPreferredSize(new java.awt.Dimension(851, 589));

        tabbedIncomeTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tabbedIncomeTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabbedIncomeTableMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tabbedIncomeTable);

        lbl_empname.setText("Name");

        lbl_empsurname.setText("Surname");

        txtEmpSurname.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEmpSurnameActionPerformed(evt);
            }
        });

        lbl_machinename.setText("Machine Name");

        lbl_machineid.setText("Machine ID");

        txtEmpMachineID.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEmpMachineIDActionPerformed(evt);
            }
        });

        lbl_clientname.setText("Client Name");

        lbl_money.setText("Money");

        txtProjectName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtProjectNameActionPerformed(evt);
            }
        });

        lbl_incomedate.setText("Date");

        lbl_project.setText("Project");

        lbl_empid.setText("ID");

        saveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Actions-document-save-icon.png"))); // NOI18N
        saveButton.setText("Save");
        saveButton.setMaximumSize(new java.awt.Dimension(80, 29));
        saveButton.setPreferredSize(new java.awt.Dimension(80, 29));
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });

        lbl_service.setText("Service");

        updateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Button-Refresh-icon.png"))); // NOI18N
        updateButton.setText("Update");
        updateButton.setMaximumSize(new java.awt.Dimension(97, 29));
        updateButton.setPreferredSize(new java.awt.Dimension(97, 29));
        updateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateButtonActionPerformed(evt);
            }
        });

        selectService.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Shipping", "Loading", "Extract of Garbage" }));
        selectService.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectServiceActionPerformed(evt);
            }
        });

        clearButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Actions-edit-clear-icon.png"))); // NOI18N
        clearButton.setText("Clear");
        clearButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(lbl_machinename)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                        .addComponent(txtEmpMachineName, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(lbl_empsurname)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtEmpSurname, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(lbl_empname)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtEmpName, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(lbl_empid)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtEmpID, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_machineid)
                            .addComponent(lbl_service)
                            .addComponent(lbl_clientname)
                            .addComponent(lbl_project)
                            .addComponent(lbl_money)
                            .addComponent(lbl_incomedate))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtDate, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE)
                            .addComponent(selectService, 0, 1, Short.MAX_VALUE)
                            .addComponent(txtEmpMachineID)
                            .addComponent(txtClientName)
                            .addComponent(txtProjectName)
                            .addComponent(txtMoney, javax.swing.GroupLayout.Alignment.TRAILING))))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(updateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 557, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_empid)
                            .addComponent(txtEmpID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpName, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_empname))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpSurname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_empsurname))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpMachineName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_machinename))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpMachineID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_machineid))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(selectService, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_service)))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtClientName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_clientname)
                    .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(updateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtProjectName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_project))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtMoney, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_money))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_incomedate))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Income", jPanel1);

        tabbedOutcomeTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tabbedOutcomeTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabbedOutcomeTableMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tabbedOutcomeTable);

        lbl_id.setText("ID");

        lbl_name.setText("Name");

        lbl_surname.setText("Surname");

        lbl_machine_name.setText("Machine Name");

        lbl_machine_id.setText("Machine ID");

        lbl_maintenance.setText("Maintenance");

        txtSalary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSalaryActionPerformed(evt);
            }
        });

        lbl_salary.setText("Salary");

        lbl_date.setText("Date");

        clearOutcomeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Actions-edit-clear-icon.png"))); // NOI18N
        clearOutcomeButton.setText("Clear");
        clearOutcomeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearOutcomeButtonActionPerformed(evt);
            }
        });

        saveOutcomeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Actions-document-save-icon.png"))); // NOI18N
        saveOutcomeButton.setText("Save");
        saveOutcomeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveOutcomeButtonActionPerformed(evt);
            }
        });

        updateOutcomeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Button-Refresh-icon.png"))); // NOI18N
        updateOutcomeButton.setText("Update");
        updateOutcomeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateOutcomeButtonActionPerformed(evt);
            }
        });

        chartButton.setText("Pie Chart");
        chartButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chartButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_id)
                    .addComponent(lbl_name)
                    .addComponent(lbl_surname)
                    .addComponent(lbl_machine_name)
                    .addComponent(lbl_machine_id)
                    .addComponent(lbl_maintenance)
                    .addComponent(lbl_salary)
                    .addComponent(lbl_date))
                .addGap(31, 31, 31)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtEmpsurname, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEmpMachinename, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEmpname, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEmpid, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEmpMachineid, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMaintenance, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtSalary, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(36, 36, 36)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(clearOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(saveOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(updateOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(chartButton)
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(txtDateOutcome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_id))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_name))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpsurname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_surname))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpMachinename, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_machine_name))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmpMachineid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_machine_id))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtMaintenance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_maintenance)))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_salary)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtSalary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(clearOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(saveOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(updateOutcomeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(chartButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtDateOutcome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_date))
                .addContainerGap(104, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Outcome", jPanel2);

        fileChooseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginview/Documents-icon.png"))); // NOI18N
        fileChooseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileChooseButtonActionPerformed(evt);
            }
        });

        tabbedDocTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tabbedDocTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabbedDocTableMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tabbedDocTable);

        jLabel2.setText("Document Number");

        jLabel3.setText("Comments");

        saveDocButton.setText("Save Document");
        saveDocButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveDocButtonActionPerformed(evt);
            }
        });

        clearDocButton.setText("Clear");
        clearDocButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearDocButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(txtChooser)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(fileChooseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtDocNumber)
                                    .addComponent(txtComments)))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(saveDocButton)
                        .addGap(18, 18, 18)
                        .addComponent(clearDocButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 39, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(fileChooseButton, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txtChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtDocNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtComments, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(saveDocButton)
                            .addComponent(clearDocButton)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(254, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Document", jPanel3);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 879, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 508, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(machinePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(reportPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 851, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(machinePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 532, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(reportPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Update_table(){
    String sql = "SELECT * FROM Employee where Machine_name='Excavator'";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    mainTable.setModel(DbUtils.resultSetToTableModel(rs));
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) {} }
}
    
    public void ComboSelect(){
        int select = selectMachine.getSelectedIndex();
        if(select==0){
            String sql = "SELECT Employee_id, Name, Surname, Machine_name, Machine_ID  FROM Employee where Machine_name = 'Excavator'";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    mainTable.setModel(DbUtils.resultSetToTableModel(rs));
    
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { }
        }
    }
        else if(select==1){
        String sql = "SELECT Employee_id, Name, Surname, Machine_name, Machine_ID FROM Employee where Machine_name = 'Truck'";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    mainTable.setModel(DbUtils.resultSetToTableModel(rs));
    
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { }
        }
    }
    }
    
    private void incomeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incomeButtonActionPerformed
        IncomeViewFrame inFrame = new IncomeViewFrame();
        inFrame.setVisible(true);
        dispose();

    }//GEN-LAST:event_incomeButtonActionPerformed

    private void outcomeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outcomeButtonActionPerformed
        OutcomeViewFrame outFrame = new OutcomeViewFrame();
        outFrame.setVisible(true);
        dispose();
      
    }//GEN-LAST:event_outcomeButtonActionPerformed

    private void profileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profileButtonActionPerformed
        ProfileViewFrame proFrame = new ProfileViewFrame();
        proFrame.setVisible(true);
        dispose();
        
    }//GEN-LAST:event_profileButtonActionPerformed

    private void employerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_employerButtonActionPerformed
        try{
        EmployerViewFrame empFrame = new EmployerViewFrame();
        empFrame.setVisible(true);
        dispose();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
    }//GEN-LAST:event_employerButtonActionPerformed

    private void selectMachinePopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_selectMachinePopupMenuWillBecomeInvisible
        ComboSelect();
        String tmp = selectMachine.getSelectedItem().toString();
        String sql = "SELECT * FROM Employee where Machine_name=?";
        try{
            pst = conn.prepareStatement(sql);
            pst.setString(1, tmp);
            rs = pst.executeQuery();
            
              
            
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
        try{
        rs.close(); 
        pst.close(); }
        catch(Exception e) { } }

    }//GEN-LAST:event_selectMachinePopupMenuWillBecomeInvisible

    private void homeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_homeButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_homeButtonActionPerformed

    private void mainTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mainTableMouseClicked
       try{
            int row = mainTable.getSelectedRow();
            String tableClick = (mainTable.getModel().getValueAt(row, 0).toString());
            String sql = "SELECT * FROM Employee where Employee_id='"+tableClick+"' ";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            if(rs.next()){
                String add1 = rs.getString("Employee_id");
                txtEmpID.setText(add1);
                
                String add2 = rs.getString("Name");
                txtEmpName.setText(add2);
                
                String add3 = rs.getString("Surname");
                txtEmpSurname.setText(add3);
                
                String add4 = rs.getString("Machine_name");
                txtEmpMachineName.setText(add4);
                
                String add5 = rs.getString("Machine_id");
                txtEmpMachineID.setText(add5);
                
                String add6 = rs.getString("Employee_id");
                txtEmpid.setText(add6);
                
                String add7 = rs.getString("Name");
                txtEmpname.setText(add7);
                
                String add8 = rs.getString("Surname");
                txtEmpsurname.setText(add8);
                
                String add9 = rs.getString("Machine_name");
                txtEmpMachinename.setText(add9);
                
                String add10 = rs.getString("Machine_id");
                txtEmpMachineid.setText(add10);
                
                
               
            }
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
             
       finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }
       
    }//GEN-LAST:event_mainTableMouseClicked

    
    private void Update_IncomeTable(){
    String sql = "SELECT * FROM Income";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    tabbedIncomeTable.setModel(DbUtils.resultSetToTableModel(rs));
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
}
    private void Update_OutcomeTable(){
    String sql = "SELECT * FROM Outcome";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    tabbedOutcomeTable.setModel(DbUtils.resultSetToTableModel(rs));
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
    }
    
    private void Update_DocumentTable(){
    String sql = "SELECT * FROM Document";
    try{
    pst = conn.prepareStatement(sql);
    rs = pst.executeQuery();
    tabbedDocTable.setModel(DbUtils.resultSetToTableModel(rs));
    }
    catch(Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
}
    
    private void totalButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_totalButtonActionPerformed
        try{
            TotalViewFrame totalFrame = new TotalViewFrame();
        totalFrame.setVisible(true);
        dispose();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
    }//GEN-LAST:event_totalButtonActionPerformed

    private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
      
        try{
            String sql = "INSERT INTO Income (ID, Name, Surname, Machine_name, Machine_ID,Service, Client_name, Project, Money, Date) VALUES (?,?,?,?,?,?,?,?,?,?)";
            pst = conn.prepareStatement(sql);
            pst.setString(1, txtEmpID.getText());
            pst.setString(2, txtEmpName.getText());
            pst.setString(3, txtEmpSurname.getText());
            pst.setString(4, txtEmpMachineName.getText());
            pst.setString(5, txtEmpMachineID.getText());
            
            String value = selectService.getSelectedItem().toString();
            pst.setString(6, value);
            pst.setString(7, txtClientName.getText());
            pst.setString(8, txtProjectName.getText());
            pst.setString(9, txtMoney.getText());
            pst.setString(10, ((JTextField)txtDate.getDateEditor().getUiComponent()).getText());
            
            pst.execute();
        }
       
        
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
        try{
        rs.close(); 
        pst.close(); }
        catch(Exception e) { } }
        
        Update_IncomeTable();
        
        
    }//GEN-LAST:event_saveButtonActionPerformed

    private void txtEmpMachineIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmpMachineIDActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEmpMachineIDActionPerformed

    private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed
        try{
            String value1 = txtEmpID.getText();
            String value2 = txtEmpName.getText();
            String value3 = txtEmpSurname.getText();
            String value4 = txtEmpMachineName.getText();
            String value5 = txtEmpMachineID.getText();
            
            String value6 = selectService.getSelectedItem().toString();
            
            String value7 = txtClientName.getText();
            String value8 = txtProjectName.getText();
            String value9 = txtMoney.getText();
            String value10 = ((JTextField)txtDate.getDateEditor().getUiComponent()).getText();
            
            String sql = "UPDATE INCOME SET ID = '"+value1+"', Name = '"+value2+"', Surname = '"+value3+"', Machine_name = '"+value4+"', Machine_id = '"+value5+"', Service = '"+value6+"', Client_name = '"+value7+"', Project = '"+value8+"', Money = '"+value9+"', Date = '"+value10+"' where ID = '"+value1+"'";
            pst = conn.prepareStatement(sql);
            pst.executeUpdate();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
        try{
        rs.close(); 
        pst.close(); }
        catch(Exception e) { } }
        
        Update_IncomeTable();
    }//GEN-LAST:event_updateButtonActionPerformed

    private void tabbedIncomeTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabbedIncomeTableMouseClicked
        try{
            int row = tabbedIncomeTable.getSelectedRow();
            String tableClick = (tabbedIncomeTable.getModel().getValueAt(row, 0).toString());
            String sql = "SELECT * FROM Income where ID='"+tableClick+"' ";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            if(rs.next()){
                String add1 = rs.getString("ID");
                txtEmpID.setText(add1);
                
                String add2 = rs.getString("Name");
                txtEmpName.setText(add2);
                
                String add3 = rs.getString("Surname");
                txtEmpSurname.setText(add3);
                
                String add4 = rs.getString("Machine_name");
                txtEmpMachineName.setText(add4);
                
                String add5 = rs.getString("Machine_id");
                txtEmpMachineID.setText(add5);
                
//                String add6 = rs.getString("Service");
//                txtService.setText(add6);
                
                String add7 = rs.getString("Client_name");
                txtClientName.setText(add7);
                
                String add8 = rs.getString("Project");
                txtProjectName.setText(add8);
                
                String add9 = rs.getString("Money");
                txtMoney.setText(add9);
                
                Date add10 = rs.getDate("Date");
                txtDate.setDate(add10);
                
                
               
            }
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
             
       finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }

        Update_IncomeTable();
    }//GEN-LAST:event_tabbedIncomeTableMouseClicked

    private void txtEmpSurnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmpSurnameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEmpSurnameActionPerformed

    private void txtProjectNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtProjectNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtProjectNameActionPerformed

    private void txtSalaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSalaryActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtSalaryActionPerformed

    private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
        try{
            txtEmpID.setText(null);
            txtEmpName.setText(null);
            txtEmpSurname.setText(null);
            txtEmpMachineName.setText(null);
            txtEmpMachineID.setText(null);
            txtClientName.setText(null);
            txtProjectName.setText(null);
            txtMoney.setText(null);
            txtDate.setDate(null);
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        
        finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }

    }//GEN-LAST:event_clearButtonActionPerformed

    private void selectServiceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectServiceActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_selectServiceActionPerformed

    private void clearOutcomeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearOutcomeButtonActionPerformed
        try{
            txtEmpid.setText(null);
            txtEmpname.setText(null);
            txtEmpsurname.setText(null);
            txtEmpMachinename.setText(null);
            txtEmpMachineid.setText(null);
            txtMaintenance.setText(null);
            txtSalary.setText(null);
            txtDateOutcome.setDate(null);
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }

    }//GEN-LAST:event_clearOutcomeButtonActionPerformed

    private void saveOutcomeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveOutcomeButtonActionPerformed
        try{
            String sql = "INSERT INTO Outcome (ID, Name, Surname, Machine_name, Machine_ID,Maintenance, Salary, Date) VALUES (?,?,?,?,?,?,?,?)";
            pst = conn.prepareStatement(sql);
            pst.setString(1, txtEmpid.getText());
            pst.setString(2, txtEmpname.getText());
            pst.setString(3, txtEmpsurname.getText());
            pst.setString(4, txtEmpMachinename.getText());
            pst.setString(5, txtEmpMachineid.getText());
            pst.setString(6, txtMaintenance.getText());
            pst.setString(7, txtSalary.getText());
            pst.setString(8, ((JTextField)txtDateOutcome.getDateEditor().getUiComponent()).getText());
            
            
            pst.execute();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }
        Update_OutcomeTable();
    }//GEN-LAST:event_saveOutcomeButtonActionPerformed

    private void updateOutcomeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateOutcomeButtonActionPerformed
        try{
            String value1 = txtEmpid.getText();
            String value2 = txtEmpname.getText();
            String value3 = txtEmpsurname.getText();
            String value4 = txtEmpMachinename.getText();
            String value5 = txtEmpMachineid.getText();
            String value6 = txtMaintenance.getText();
            String value7 = txtSalary.getText();
            String value8 = ((JTextField)txtDateOutcome.getDateEditor().getUiComponent()).getText();
            
            String sql = "UPDATE Outcome SET ID = '"+value1+"', Name = '"+value2+"', Surname = '"+value3+"', Machine_name = '"+value4+"', Machine_id = '"+value5+"', Maintenance = '"+value6+"', Salary = '"+value7+"', Date = '"+value8+"' where ID = '"+value1+"'";
            pst = conn.prepareStatement(sql);
            pst.executeUpdate();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
        finally {
        try{
        rs.close(); 
        pst.close(); }
        catch(Exception e) { } }
        
        Update_OutcomeTable();

    }//GEN-LAST:event_updateOutcomeButtonActionPerformed

    private void tabbedOutcomeTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabbedOutcomeTableMouseClicked
         try{
            int row = tabbedOutcomeTable.getSelectedRow();
            String tableClick = (tabbedOutcomeTable.getModel().getValueAt(row, 0).toString());
            String sql = "SELECT * FROM Outcome where ID='"+tableClick+"' ";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            if(rs.next()){
                String add1 = rs.getString("ID");
                txtEmpid.setText(add1);
                
                String add2 = rs.getString("Name");
                txtEmpname.setText(add2);
                
                String add3 = rs.getString("Surname");
                txtEmpsurname.setText(add3);
                
                String add4 = rs.getString("Machine_name");
                txtEmpMachinename.setText(add4);
                
                String add5 = rs.getString("Machine_id");
                txtEmpMachineid.setText(add5);
                
//                String add6 = rs.getString("Service");
//                txtService.setText(add6);
                
                String add6 = rs.getString("Maintenance");
                txtMaintenance.setText(add6);
                
                String add7 = rs.getString("Salary");
                txtSalary.setText(add7);
                
              
                Date add8 = rs.getDate("Date");
                txtDateOutcome.setDate(add8);
                
                
               
            }
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
             
       finally {
       try{
       rs.close(); 
       pst.close();}
       catch(Exception e) { } }

       Update_OutcomeTable();


    }//GEN-LAST:event_tabbedOutcomeTableMouseClicked

    private void fileChooseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileChooseButtonActionPerformed
        JFileChooser chooser = new JFileChooser();
        chooser.showOpenDialog(null);
        File f = chooser.getSelectedFile();
        String filename = f.getAbsolutePath();
        txtChooser.setText(filename);
    }//GEN-LAST:event_fileChooseButtonActionPerformed

    private void saveDocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveDocButtonActionPerformed
        try{
            String sql = "INSERT INTO Document (Doc_id, Comments, Path) values(?,?,?)";
            pst = conn.prepareStatement(sql);
            pst.setString(1, txtDocNumber.getText());
            pst.setString(2, txtComments.getText());
            pst.setString(3, txtChooser.getText());
            
            pst.execute();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
        Update_DocumentTable();
    }//GEN-LAST:event_saveDocButtonActionPerformed

    private void clearDocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearDocButtonActionPerformed
        try{
            txtDocNumber.setText(null);
            txtComments.setText(null);
            txtChooser.setText(null);
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
    }//GEN-LAST:event_clearDocButtonActionPerformed

    private void tabbedDocTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabbedDocTableMouseClicked
        int row = tabbedDocTable.getSelectedRow();
        String value = (tabbedDocTable.getModel().getValueAt(row,2).toString());
        try{
            Runtime.getRuntime().exec("runddl32 url.dll, FileProtocolHandler"+value);
        }                               
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }

    }//GEN-LAST:event_tabbedDocTableMouseClicked

    private void chartButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chartButtonActionPerformed
        String salary = txtSalary.getText();
        String maintenance = txtMaintenance.getText();
        
        DefaultPieDataset pieDataset = new DefaultPieDataset();
        pieDataset.setValue("Maintenance", new Float(maintenance) );
        pieDataset.setValue("Salary", new Float(salary) );
       
        JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart", pieDataset, true, true, true);
        PiePlot3D p = (PiePlot3D)chart.getPlot();
        //p.setForegroundAlpha(TOP_ALIGNMENT);
        ChartFrame frame = new ChartFrame("Pie Chart", chart);
        frame.setVisible(true);
        frame.setSize(450, 500);
        frame.setLocation(400, 20);

    }//GEN-LAST:event_chartButtonActionPerformed

    private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
        try{
        LoginViewFrame l = new LoginViewFrame();
        l.setVisible(true);
        dispose();
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
         finally {
    try{
    rs.close(); 
    pst.close(); }
    catch(Exception e) { } }
    }//GEN-LAST:event_logoutButtonActionPerformed

    public void CurrentDate(){
       Thread clock =new Thread(){
       public void run(){
           for(;;){
        Calendar cal = new GregorianCalendar();
        int month = cal.get(Calendar.MONTH);
        int day = cal.get(Calendar.DAY_OF_MONTH);
        int year = cal.get(Calendar.YEAR);
        label_date.setText("Date "+day+"/"+(month+1)+"/"+year);
        
       int second = cal.get(Calendar.SECOND);
       int minute = cal.get(Calendar.MINUTE);
       int hour = cal.get(Calendar.HOUR_OF_DAY);
       label_time.setText("Time "+hour+":"+minute+":"+second);
               try {
                   sleep(1000);
               } catch (InterruptedException ex) {
                   Logger.getLogger(MainViewFrame.class.getName()).log(Level.SEVERE, null, ex);
               }
           }
       }
       
       };
        clock.start();
    }
    
    private void FillCombo(){
        try{
            String sql = "SELECT distinct Machine_name FROM Employee";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            
            while(rs.next()){
                String name = rs.getString("Machine_name");
                selectMachine.addItem(name);
            }
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
       new MainViewFrame().setLocation(50, 30);
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
                UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainViewFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainViewFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainViewFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainViewFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainViewFrame().setVisible(true);
                
                
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton chartButton;
    private javax.swing.JButton clearButton;
    private javax.swing.JButton clearDocButton;
    private javax.swing.JButton clearOutcomeButton;
    private javax.swing.JButton employerButton;
    private javax.swing.JButton fileChooseButton;
    private javax.swing.JButton homeButton;
    private javax.swing.JButton incomeButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel label_date;
    private javax.swing.JLabel label_time;
    private javax.swing.JLabel lbl_clientname;
    private javax.swing.JLabel lbl_date;
    private javax.swing.JLabel lbl_empid;
    private javax.swing.JLabel lbl_empname;
    private javax.swing.JLabel lbl_empsurname;
    private javax.swing.JLabel lbl_id;
    private javax.swing.JLabel lbl_incomedate;
    private javax.swing.JLabel lbl_machine_id;
    private javax.swing.JLabel lbl_machine_name;
    private javax.swing.JLabel lbl_machineid;
    private javax.swing.JLabel lbl_machinename;
    private javax.swing.JLabel lbl_maintenance;
    private javax.swing.JLabel lbl_money;
    private javax.swing.JLabel lbl_name;
    private javax.swing.JLabel lbl_project;
    private javax.swing.JLabel lbl_salary;
    private javax.swing.JLabel lbl_service;
    private javax.swing.JLabel lbl_surname;
    private javax.swing.JButton logoutButton;
    private javax.swing.JPanel machinePanel;
    private javax.swing.JTable mainTable;
    private javax.swing.JButton outcomeButton;
    private javax.swing.JButton profileButton;
    private javax.swing.JPanel reportPanel;
    private javax.swing.JButton saveButton;
    private javax.swing.JButton saveDocButton;
    private javax.swing.JButton saveOutcomeButton;
    private javax.swing.JComboBox selectMachine;
    private javax.swing.JComboBox selectService;
    private javax.swing.JTable tabbedDocTable;
    private javax.swing.JTable tabbedIncomeTable;
    private javax.swing.JTable tabbedOutcomeTable;
    private javax.swing.JButton totalButton;
    private javax.swing.JTextField txtChooser;
    private javax.swing.JTextField txtClientName;
    private javax.swing.JTextField txtComments;
    private com.toedter.calendar.JDateChooser txtDate;
    private com.toedter.calendar.JDateChooser txtDateOutcome;
    private javax.swing.JTextField txtDocNumber;
    private javax.swing.JTextField txtEmpID;
    private javax.swing.JTextField txtEmpMachineID;
    private javax.swing.JTextField txtEmpMachineName;
    private javax.swing.JTextField txtEmpMachineid;
    private javax.swing.JTextField txtEmpMachinename;
    private javax.swing.JTextField txtEmpName;
    private javax.swing.JTextField txtEmpSurname;
    private javax.swing.JTextField txtEmpid;
    private javax.swing.JTextField txtEmpname;
    private javax.swing.JTextField txtEmpsurname;
    private javax.swing.JTextField txtMaintenance;
    private javax.swing.JTextField txtMoney;
    private javax.swing.JTextField txtProjectName;
    private javax.swing.JTextField txtSalary;
    private javax.swing.JButton updateButton;
    private javax.swing.JButton updateOutcomeButton;
    // End of variables declaration//GEN-END:variables
}
